import 'package:hrt/entities/fight_result.dart';
import 'package:hrt/resources/app_colors.dart';
import 'package:hrt/resources/app_images.dart';
import 'package:flutter/material.dart';

class FightResultWidget extends StatelessWidget {
  const FightResultWidget({
    Key? key,
    required this.fightResult,
  }) : super(key: key);

  final FightResult fightResult;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 140,
      margin: EdgeInsets.all(20),
      child: Stack(
        children: [
          Row(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              Expanded(child: ColoredBox(color: AppColors.white)),
              Container(
                decoration: BoxDecoration(
                  gradient: LinearGradient(
                    colors: [AppColors.white, AppColors.darkPurple],
                  ),
                ),
              ),
              Expanded(child: ColoredBox(color: AppColors.darkPurple)),
            ],
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              const SizedBox(width: 8),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  const Text(
                    "玩家",
                    style: TextStyle(
                      color: AppColors.darkGreyText,
                      fontSize: 14,
                    ),
                  ),
                  const SizedBox(height: 10),
                  Image.asset(AppImages.youAvatar, width: 90, height: 90)
                ],
              ),
              Container(
                height: 44,
                padding:
                    const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
                decoration: BoxDecoration(
                  color: fightResult.color,
                  borderRadius: BorderRadius.circular(22),
                ),
                child: Center(
                  child: Text(
                    fightResult.result.toLowerCase(),
                    style: const TextStyle(
                      color: AppColors.white,
                      fontSize: 16,
                    ),
                  ),
                ),
              ),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  const Text(
                    "敌方",
                    style: TextStyle(
                      color: AppColors.darkGreyText,
                      fontSize: 14,
                    ),
                  ),
                  const SizedBox(height: 10),
                  Image.asset(
                    AppImages.enemyAvatar,
                    width: 90,
                    height: 90,
                  )
                ],
              ),
              const SizedBox(width: 8)
            ],
          ),
        ],
      ),
    );
  }
}
